"use strict";

/**
 * @ngdoc service
 * @name jgappApp.FileService
 * @description
 * # FileService
 * Service in the jgappApp.
 */
angular.module("jgappApp").service("FileService", [
  "openApi",
  "DataService",
  "$q",
  "Util",
  "$location",
  function(openApi, DataService, $q, Util, $location) {
    // AngularJS will instantiate a singleton by calling "new" on this function
    var FileService = {};
    FileService.delfile = function(imgData) {
      var delay = $q.defer();
      var param = {};
      param.fileName = imgData;
      DataService.getData(openApi.deleteFile, param).then(function(data) {
        delay.resolve(data);
      });
      return delay.promise;
    };
    FileService.showfile = function(imgData) {
      var param = {};
      param.data = imgData;
      param.index = 0;
      param.showbtn = true;
      NativeUtil.use("photoPreview", null, param);
    };
    return FileService;
  }
]);
